<%-- 
    Document   : EditAssets
    Created on : Apr 29, 2014, 12:22:55 PM
    Author     : mishra
--%>

<%@page import="Department.DepartmentBean"%>
<%@page import="User.UserBean"%>
<%@page import="Vendor.VendorBean"%>
<%@page import="Brand.BrandBean"%>
<%
    try {
        if (session.getAttribute("uid") != null) {
            if (session.getAttribute("Manage_Assets").toString().equals("1")) {
%>
<%String to = "", status = "", msg = "";%>
<%@page import="State.StateBean"%>
<%@page import="Country.CountryBean"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.Vector"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <title>Ramgovind Automated System</title>
        <link rel="stylesheet" href="/RIT/css/bootstrap.css">
        <link rel="stylesheet" href="/RIT/css/bootstrap-responsive.css">
        <link rel="stylesheet" href="/RIT/css/jquery.fancybox.css">
        <link rel="stylesheet" href="/RIT/css/style.css">
        <link rel="stylesheet" href="/RIT/css/iconfont.css">
        <link rel="stylesheet" href="/RIT/css/bootstrap.datepicker.css">
        <script src="../../ajax/ajax.js"></script>
        <script>
            function chkassign(val) {

                var asval = parseInt(val);
                if (asval == 1) {
                    document.getElementById('asign').style.visibility = 'visible';
                } else {
                    document.getElementById('asign').style.visibility = 'hidden';
                }
            }
        </script>
    </head>
    <body onload="getServerImage()">
        <%@include file="/topheader.html" %>
        <%@include file="/servicesheader.html" %>
        <div class="main">
            <div class="container-fluid">
                <%@include file="/Services/Assets/assetssidenav.html" %>
                <div class="content">
                    <%if (session.getAttribute("status") != null) {
                            status = session.getAttribute("status").toString();
                            msg = session.getAttribute("msg").toString();
                    %>
                    <div class="alert alert-info alert-block">
                        <a class="close" data-dismiss="alert" href="#"><img src="/RIT/img/mclose.png"></a>
                        <h4 class="alert-heading"> <%=status%></h4>
                        <%=msg%>

                    </div>
                    <%session.removeAttribute("status");
                            session.removeAttribute("msg");
                        }%>
                    <div class="row-fluid">
                        <div class="span12">
                            <div class="box">
                                <div class="box-head">
                                    <h3>Edit Assets</h3>
                                    <a href="Assets.jsp">
                                        <button style="float: right" class="btn btn-success">View Assets</button>
                                    </a>
                                </div>
                                <form action="/RIT/EditAssets" method="post" enctype="multipart/form-data" class='validate form-horizontal'>
                                    <div class="box-content">
                                        <!---Form Start....-->

                                        <div id="lside" style="float: left; margin-top: 10px;">
                                            <div class="control-group">
                                                <label for="aname" class="control-label">Assets Name<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <input type="text" name="aname" id="aname" value="<%=request.getParameter("assname")%>" class='required'>
                                                    <input type="hidden" name="assid" id="assid" value="<%=request.getParameter("aid")%>" class='required'>
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="sno" class="control-label">Serial No<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <input type="text" name="sno" id="sno" class='required' value="<%=request.getParameter("serialno")%>">
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="modelno" class="control-label">Model No<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <input type="text" name="modelno" id="modelno" class='required' value="<%=request.getParameter("modelno")%>">
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="brand" class="control-label">Brand Name<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <select class="required" name="brand" id="brand">
                                                        <option value="<%=request.getParameter("brandid")%>"><%=request.getParameter("brandname")%></option>
                                                        <%
                                                            Vector<Object> list = Brand.Query.viewAll();
                                                            Iterator it = list.iterator();
                                                            while (it.hasNext()) {
                                                                BrandBean bb = (BrandBean) it.next();
                                                        %>
                                                        <option value="<%=bb.getBrandId()%>"><%=bb.getBrandName()%></option>
                                                        <%}%>
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="vendor" class="control-label">Vendor Name<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <select class="required" name="vendor" id="vendor">
                                                        <option value="<%=request.getParameter("vendid")%>"><%=request.getParameter("vendname")%></option>
                                                        <%
                                                            Vector<Object> list1 = Vendor.Query.viewAll();
                                                            Iterator it1 = list1.iterator();
                                                            while (it1.hasNext()) {
                                                                VendorBean vb = (VendorBean) it1.next();
                                                        %>
                                                        <option value="<%=vb.getVendorId()%>"><%=vb.getVendorName()%></option>
                                                        <%}%>
                                                    </select>

                                                </div>
                                            </div>

                                            <div class="control-group">
                                                <label for="desc" class="control-label">Description</label>
                                                <div class="controls">
                                                    <textarea name="desc" id="desc" style="height: 70px;"><%=request.getParameter("desc")%></textarea>
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="desc" class="control-label">Do You Want to Assign</label>
                                                <div class="controls">
                                                    <input type="radio" name="asgn" id="asgn1" value="1" onload="chkassign(this.value)" onchange="chkassign(this.value)" <%if (Integer.parseInt(request.getParameter("assStatus")) == 1) {%>checked<%}%>>Yes &nbsp;&nbsp;&nbsp;&nbsp;
                                                    &nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="asgn" id="asgn1" value="0" onchange="chkassign(this.value)" onload== "chkassign(this.value)" <%if (Integer.parseInt(request.getParameter("assStatus")) == 0) {%>checked<%}%>>No
                                                </div>
                                            </div>
                                        </div>
                                        <div id="rside" style="float: left; margin-top: 10px">
                                            <div class="control-group">
                                                <label for="accqdate" class="control-label">Acquire Date<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <input type="text" name="accqdate" id="accqdate" class="input-square datepick required" readonly value="<%=request.getParameter("accDate")%>">
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="warstart" class="control-label">Warranty Start<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <input type="text" name="warstart" id="warstart" class='input-square datepick required' readonly value="<%=request.getParameter("warrstart")%>">
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="warend" class="control-label">Warranty End<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <input type="text" name="warend" id="warend" class='input-square datepick required' readonly value="<%=request.getParameter("warend")%>">
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="depart" class="control-label">Department<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <select  name="depart" id="depart">
                                                        <option value="<%=request.getParameter("departid")%>"><%=request.getParameter("departname")%></option>
                                                        <%
                                                            Vector<Object> list3 = Department.Query.viewAll();
                                                            Iterator it3 = list3.iterator();
                                                            while (it3.hasNext()) {
                                                                DepartmentBean db = (DepartmentBean) it3.next();
                                                        %>
                                                        <option value="<%=db.getDepartmentId()%>"><%=db.getDepartmentName()%></option>
                                                        <%}%>
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <div class="controls">
                                                    <ul class="gallery">
                                                        <li>
                                                            <span  class="preview" id="photo1">
                                                                <img id="photo" style="height: 115px;width: 90px; cursor: -webkit-zoom-in;" title="<%=request.getParameter("photo")%>" src="" alt="">
                                                            </span>
                                                        </li>
                                                    </ul>
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="picture" class="control-label">Assets Picture<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <input type="file" name="picture" id="picture" onchange="setPhoto(this.id, 'photo')" value="<%=request.getParameter("photo")%>">
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="attachment" class="control-label">Attachment<span style="color:red"></span></label>
                                                <div class="controls">
                                                    <input type="file" name="attach" id="attach" value="<%=request.getParameter("attac")%>">
                                                </div>
                                            </div>
                                        </div>
                                        <div id="asign">
                                            <legend>Assign Details</legend>
                                            <div id="lside" style="float: left; margin-top: 10px;">
                                                <div class="control-group">
                                                    <label for="assemp" class="control-label">Assign Employee<span style="color:red">*</span></label>
                                                    <div class="controls">
                                                        <select name="assemp" id="assemp">
                                                            <option value="<%=request.getParameter("empid")%>"><%=request.getParameter("empname")%></option>
                                                            <%
                                                                Vector<Object> list2 = User.Query.viewAll();
                                                                Iterator it2 = list2.iterator();
                                                                while (it2.hasNext()) {
                                                                    UserBean ub = (UserBean) it2.next();
                                                            %>
                                                            <option value="<%=ub.getUserId()%>"><%=ub.getEmployeeName()%></option>
                                                            <%}%>
                                                        </select>
                                                    </div>
                                                </div>
                                            </div>
                                            <div id="rside" style="float: left; margin-top: 10px">
                                                <div class="control-group">
                                                    <label for="adate" class="control-label">Assigned Date<span style="color:red">*</span></label>
                                                    <div class="controls">
                                                        <input type="text" readonly name="adate" id="adate" class='input-square datepick' value="<%=request.getParameter("assdate")%>">
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <!---Form Ends....-->
                                    </div>
                                    <div class="form-actions">
                                        <input type="submit" class='btn btn-primary'>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>	
            </div>
        </div>
        <script src="/RIT/js/jquery.js"></script>
        <script src="/RIT/js/less.js"></script>
        <script src="/RIT/js/bootstrap.min.js"></script>
        <script src="/RIT/js/jquery.uniform.min.js"></script>
        <script src="/RIT/js/bootstrap.timepicker.js"></script>
        <script src="/RIT/js/bootstrap.datepicker.js"></script>
        <script src="/RIT/js/chosen.jquery.min.js"></script>
        <script src="/RIT/js/jquery.fancybox.js"></script>
        <script src="/RIT/js/plupload/plupload.full.js"></script>
        <script src="/RIT/js/plupload/jquery.plupload.queue/jquery.plupload.queue.js"></script>
        <script src="/RIT/js/jquery.cleditor.min.js"></script>
        <script src="/RIT/js/jquery.inputmask.min.js"></script>
        <script src="/RIT/js/jquery.tagsinput.min.js"></script>
        <script src="/RIT/js/jquery.mousewheel.js"></script>
        <script src="/RIT/js/jquery.textareaCounter.plugin.js"></script>
        <script src="/RIT/js/ui.spinner.js"></script>
        <script src="/RIT/js/jquery.jgrowl_minimized.js"></script>
        <script src="/RIT/js/jquery.form.js"></script>
        <script src="/RIT/js/jquery.validate.min.js"></script>
        <script src="/RIT/js/bbq.js"></script>
        <script src="/RIT/js/jquery-ui-1.8.22.custom.min.js"></script>
        <script src="/RIT/js/jquery.form.wizard-min.js"></script>
        <script src="/RIT/js/jquery.cookie.js"></script>
        <script src="/RIT/js/jquery.metadata.js"></script>
        <script src="/RIT/js/custom.js"></script><script src="/RIT/js/demo.js"></script>
        <script src="/RIT/js/iconfont.js"></script>
    </body>
</html>

<%} else {
%>
<script type="text/javascript">
                                                        alert("You Are Not Authorised");
                                                        window.history.back();
</script>
<%             }
        } else {
            request.setAttribute("msg", "You Are Not Authorised! Please Contact to System Administrator!");
            request.setAttribute("value", "0");
            getServletContext().getRequestDispatcher("/index.jsp").forward(request, response);
        }
    } catch (Exception e) {
        request.setAttribute("msg", "Please Contact to System Administrator!");
        request.setAttribute("value", "0");
        getServletContext().getRequestDispatcher("/index.jsp").forward(request, response);
    }
%>
